package org.chartsy.annotation.line;
import java.awt.Color;
import java.awt.Stroke;
import java.util.logging.Level;
import org.chartsy.main.chart.AbstractPropertiesNode;
import org.chartsy.main.utils.SerialVersion;
import org.chartsy.main.utils.StrokeGenerator;
import org.chartsy.main.utils.StrokePropertyEditor;
import org.openide.nodes.Sheet;
/**
*
* @author viorel.gheba
*/
public class AnnotationNode
extends AbstractPropertiesNode
{
private static final long serialVersionUID = SerialVersion.APPVERSION;
public AnnotationNode()
{
super("Line Properties");
}
public AnnotationNode(AnnotationProperties annotationProperties)
{
super("Line Properties", annotationProperties);
}
@SuppressWarnings("unchecked")
protected @Override Sheet createSheet()
{
Sheet sheet = Sheet.createDefault();
Sheet.Set set = getPropertiesSet();
sheet.put(set);
try
{
// Line Color
set.put(getProperty(
"Line Color", // property name
"Sets the line color", // property description
AnnotationProperties.class, // properties class
Color.class, // property class
null, // property editor class (null if none)
"getColor", // get method name
"setColor", // set method name
AnnotationProperties.COLOR // default property value
));
// Line Style
set.put(getProperty(
"Line Style", // property name
"Sets the line style", // property description
AnnotationProperties.class, // properties class
Stroke.class, // property class
StrokePropertyEditor.class, // property editor class (null if none)
"getStroke", // get method name
"setStroke", // set method name
StrokeGenerator.getStroke(AnnotationProperties.STROKE_INDEX) // default property value
));
}
catch (NoSuchMethodException ex)
{
LOG.log(Level.SEVERE, "[LineNode] : Method does not exist.", ex);
}
return sheet;
}
}